//
//  YMComposeTextView.swift
//  YMWeiBo
//
//  Created by mimi on 16/7/26.
//  Copyright © 2016年 mimi. All rights reserved.
//

import UIKit

class YMComposeTextView: UITextView {
    
    
    override init(frame: CGRect, textContainer: NSTextContainer?) {
        super.init(frame: frame, textContainer: textContainer)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    

    //        MARK: - =========== 响应事件 ===========
    
    
    
    
    
    
    
    func setupUI () {
        
        
        //        MARK: - 设置控件
        //1.添加控件
        addSubview(placeholderLabel)
        
        
        
        //2.设置约束
        placeholderLabel.snp_makeConstraints { (make) in
            make.top.equalTo(self).offset(8)
            make.leading.equalTo(self).offset(5)
        }
        
        
    }
    
    
    
    
    //        MARK: - ==========  属性声明  =============
    
    var placeholder:String?{
        didSet{
            placeholderLabel.text = placeholder
        }
    }
    
    
    
    
    
    
    
    //        MARK: -============= 懒加载控件 =============

    private lazy var placeholderLabel:UILabel = {
       let lb = UILabel()
        lb.font = UIFont.systemFontOfSize(15)
        lb.textColor = RGB(237, green: 237, blue: 237)
        
        lb.numberOfLines = 0
        lb.preferredMaxLayoutWidth = SCREENW - 10
        
        return lb
        
    }()

}
